// 引入mysql的配置文件
const db = require('../../db.config');

// 引入sequelize对象
const Sequelize = db.sequelize;

// 引入数据表模型
const CosmeticsType = Sequelize.import('../../schema/base/cosmeticsBrand.js');
CosmeticsType.sync({force: false}); //自动创建表

class CosmeticsBrandModule {
  /**
   * 新增化妆品种类
   * @param data {id: Number, zhName: String, enName: String }
   */
  static async addCosmeticsType(data) {
    return await CosmeticsType.create({
      cosmeticsId: data.id,
      zhName: data.zhName,
      enName: data.enName,
    })
  }

  static async getCosmeticsList() {
    return await CosmeticsType.findAll()
  }


}

module.exports = CosmeticsBrandModule